<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>许愿墙 - 筛选查询</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #8b5cf6; /* 主色调：紫色，代表梦想和希望 */
            --primary-light: #c4b5fd;
            --primary-dark: #6d28d9;
            --secondary: #ec4899; /* 辅助色：粉色，代表浪漫 */
            --accent: #f59e0b; /* 强调色：橙色，代表活力 */
            --success: #10b981; /* 成功色：绿色 */
            --text-primary: #1f2937;
            --text-secondary: #6b7280;
            --text-light: #9ca3af;
            --bg-light: #f9fafb;
            --bg-white: #ffffff;
            --border-light: #e5e7eb;
            --radius: 12px;
            --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 55px;
            padding-bottom: 75px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 55px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 15px;
            z-index: 1000;
            border-bottom: 1px solid var(--border-light);
            box-shadow: var(--shadow);
        }
        
        .nav-title {
            font-size: 1.15rem;
            font-weight: 600;
            color: var(--primary-dark);
        }
        
        .nav-action {
            color: var(--text-secondary);
            background: none;
            border: none;
            font-size: 1.2rem;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .nav-action:hover {
            background-color: var(--bg-light);
        }
        
        /* 搜索和筛选区域 */
        .search-filter-container {
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            padding-bottom: 10px;
        }
        
        .search-bar {
            padding: 12px 15px;
            position: relative;
        }
        
        .search-input {
            width: 100%;
            padding: 10px 15px 10px 40px;
            border-radius: 30px;
            border: 1px solid var(--border-light);
            background-color: var(--bg-light);
            font-size: 0.9rem;
        }
        
        .search-input:focus {
            outline: none;
            border-color: var(--primary-light);
            box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
        }
        
        .search-icon {
            position: absolute;
            left: 30px;
            top: 22px;
            color: var(--text-secondary);
        }
        
        /* 筛选按钮组 */
        .filter-buttons {
            display: flex;
            padding: 0 15px;
            gap: 8px;
            margin-bottom: 10px;
            overflow-x: auto;
            scrollbar-width: none;
        }
        
        .filter-buttons::-webkit-scrollbar {
            display: none;
        }
        
        .filter-btn {
            flex: 0 0 auto;
            padding: 6px 14px;
            border-radius: 20px;
            border: 1px solid var(--border-light);
            background-color: var(--bg-white);
            color: var(--text-secondary);
            font-size: 0.85rem;
            display: flex;
            align-items: center;
            gap: 5px;
        }
        
        .filter-btn.active {
            background-color: var(--primary);
            color: white;
            border-color: var(--primary);
        }
        
        /* 高级筛选面板 */
        .advanced-filter {
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            padding: 15px;
            display: none;
        }
        
        .advanced-filter.show {
            display: block;
        }
        
        .filter-section {
            margin-bottom: 15px;
        }
        
        .filter-title {
            font-size: 0.95rem;
            font-weight: 600;
            margin-bottom: 10px;
            color: var(--text-primary);
        }
        
        .filter-options {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }
        
        .filter-option {
            padding: 6px 12px;
            border-radius: 16px;
            font-size: 0.85rem;
            border: 1px solid var(--border-light);
            background-color: var(--bg-white);
            color: var(--text-secondary);
        }
        
        .filter-option.active {
            background-color: rgba(139, 92, 246, 0.1);
            color: var(--primary);
            border-color: var(--primary-light);
        }
        
        .date-range {
            display: flex;
            gap: 10px;
        }
        
        .date-input {
            flex: 1;
            padding: 8px 12px;
            border-radius: 8px;
            border: 1px solid var(--border-light);
            font-size: 0.85rem;
            color: var(--text-secondary);
        }
        
        .filter-actions {
            display: flex;
            gap: 10px;
            margin-top: 10px;
        }
        
        .reset-btn {
            flex: 1;
            padding: 10px;
            border-radius: 8px;
            border: 1px solid var(--border-light);
            background-color: var(--bg-white);
            color: var(--text-secondary);
            font-size: 0.9rem;
        }
        
        .apply-btn {
            flex: 1;
            padding: 10px;
            border-radius: 8px;
            border: none;
            background-color: var(--primary);
            color: white;
            font-size: 0.9rem;
        }
        
        /* 分类标签 */
        .category-tabs {
            display: flex;
            padding: 0 15px;
            background-color: var(--bg-white);
            overflow-x: auto;
            scrollbar-width: none;
            border-bottom: 1px solid var(--border-light);
        }
        
        .category-tabs::-webkit-scrollbar {
            display: none;
        }
        
        .category-tab {
            flex: 0 0 auto;
            padding: 12px 18px;
            font-size: 0.9rem;
            font-weight: 500;
            color: var(--text-secondary);
            background: none;
            border: none;
            border-bottom: 2px solid transparent;
            margin-right: 5px;
        }
        
        .category-tab.active {
            color: var(--primary);
            border-bottom-color: var(--primary);
        }
        
        /* 筛选结果统计 */
        .filter-result {
            padding: 10px 15px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            font-size: 0.85rem;
            color: var(--text-secondary);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .result-count {
            font-weight: 500;
        }
        
        .clear-filters {
            color: var(--primary);
            background: none;
            border: none;
            font-size: 0.85rem;
        }
        
        /* 许愿卡片样式 */
        .wish-list {
            padding: 10px 15px;
        }
        
        .wish-card {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            margin-bottom: 15px;
            overflow: hidden;
            box-shadow: var(--shadow);
            transition: transform 0.2s ease;
        }
        
        .wish-card:hover {
            transform: translateY(-2px);
        }
        
        .wish-header {
            padding: 12px 15px;
            display: flex;
            align-items: center;
            gap: 10px;
            border-bottom: 1px solid var(--border-light);
        }
        
        .wish-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
        }
        
        .wish-user {
            flex: 1;
        }
        
        .user-name {
            font-size: 0.95rem;
            font-weight: 500;
            margin-bottom: 2px;
        }
        
        .wish-time {
            font-size: 0.75rem;
            color: var(--text-secondary);
        }
        
        .wish-content {
            padding: 15px;
        }
        
        .wish-title {
            font-size: 1.05rem;
            font-weight: 600;
            margin-bottom: 8px;
            color: var(--primary-dark);
        }
        
        .wish-description {
            font-size: 0.9rem;
            line-height: 1.5;
            margin-bottom: 12px;
        }
        
        /* 图片容器样式 */
        .wish-media {
            margin-bottom: 12px;
        }
        
        .no-media {
            display: none;
        }
        
        .single-media {
            width: 100%;
            border-radius: 8px;
            overflow: hidden;
        }
        
        .single-media img {
            width: 100%;
            height: 200px;
            object-fit: cover;
        }
        
        .multi-media {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 3px;
            border-radius: 8px;
            overflow: hidden;
        }
        
        .media-item {
            aspect-ratio: 1/1;
            overflow: hidden;
        }
        
        .media-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        /* 许愿标签和状态 */
        .wish-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 12px;
        }
        
        .wish-tag {
            background-color: rgba(139, 92, 246, 0.1);
            color: var(--primary);
            font-size: 0.8rem;
            padding: 3px 10px;
            border-radius: 12px;
        }
        
        .wish-status {
            font-size: 0.8rem;
            padding: 3px 10px;
            border-radius: 12px;
            font-weight: 500;
        }
        
        .status-pending {
            background-color: rgba(245, 158, 11, 0.1);
            color: var(--accent);
        }
        
        .status-fulfilled {
            background-color: rgba(16, 185, 129, 0.1);
            color: var(--success);
        }
        
        /* 互动区域 */
        .wish-actions {
            display: flex;
            justify-content: space-around;
            padding: 8px 0;
            border-top: 1px solid var(--border-light);
        }
        
        .action-btn {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 5px 0;
            background: none;
            border: none;
            color: var(--text-secondary);
            font-size: 0.75rem;
            width: 100%;
            gap: 3px;
        }
        
        .action-btn i {
            font-size: 1rem;
        }
        
        .action-btn:hover, .action-btn.active {
            color: var(--primary);
        }
        
        .action-count {
            font-size: 0.7rem;
        }
        
        /* 底部悬浮按钮 */
        .add-wish-btn {
            position: fixed;
            right: 20px;
            bottom: 85px;
            width: 56px;
            height: 56px;
            border-radius: 50%;
            background-color: var(--primary);
            color: white;
            border: none;
            box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            z-index: 900;
        }
        
        .add-wish-btn:hover {
            background-color: var(--primary-dark);
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 65px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: var(--text-secondary);
            font-size: 0.7rem;
            text-decoration: none;
        }
        
        .nav-item i {
            font-size: 1.3rem;
            margin-bottom: 3px;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        /* 提示消息 */
        .toast-notification {
            position: fixed;
            bottom: 80px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 8px 16px;
            border-radius: 4px;
            z-index: 9999;
            font-size: 0.9rem;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        .toast-notification.show {
            opacity: 1;
        }
        
        /* 空状态 */
        .empty-state {
            padding: 60px 20px;
            text-align: center;
            color: var(--text-secondary);
        }
        
        .empty-icon {
            font-size: 4rem;
            margin-bottom: 20px;
            color: var(--primary-light);
            opacity: 0.6;
        }
        
        .empty-text {
            font-size: 1rem;
            margin-bottom: 20px;
        }
        
        .empty-action {
            padding: 10px 20px;
            background-color: var(--primary);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 0.9rem;
            font-weight: 500;
        }
        
        /* 加载更多 */
        .load-more {
            width: 100%;
            padding: 12px;
            margin: 10px 0 20px;
            background-color: var(--bg-white);
            border: 1px solid var(--border-light);
            border-radius: var(--radius);
            color: var(--text-secondary);
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <button class="nav-action" id="backBtn">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="nav-title">心愿许愿墙</div>
        <button class="nav-action" id="sortBtn">
            <i class="fas fa-sort"></i>
        </button>
    </div>
    
    <!-- 搜索和筛选区域 -->
    <div class="search-filter-container">
        <div class="search-bar">
            <i class="fas fa-search search-icon"></i>
            <input type="text" class="search-input" placeholder="搜索心愿、标签或用户...">
        </div>
        
        <div class="filter-buttons">
            <button class="filter-btn" id="advancedFilterBtn">
                <i class="fas fa-sliders-h"></i> 高级筛选
            </button>
            <button class="filter-btn">
                <i class="fas fa-clock"></i> 最新
            </button>
            <button class="filter-btn">
                <i class="fas fa-fire"></i> 热门
            </button>
            <button class="filter-btn">
                <i class="fas fa-image"></i> 有图
            </button>
            <button class="filter-btn">
                <i class="fas fa-check-circle"></i> 已实现
            </button>
        </div>
        
        <!-- 高级筛选面板 -->
        <div class="advanced-filter" id="advancedFilterPanel">
            <div class="filter-section">
                <div class="filter-title">愿望状态</div>
                <div class="filter-options">
                    <button class="filter-option active">全部状态</button>
                    <button class="filter-option">待实现</button>
                    <button class="filter-option">进行中</button>
                    <button class="filter-option">已实现</button>
                </div>
            </div>
            
            <div class="filter-section">
                <div class="filter-title">愿望分类</div>
                <div class="filter-options">
                    <button class="filter-option active">全部分类</button>
                    <button class="filter-option">旅行愿望</button>
                    <button class="filter-option">学习目标</button>
                    <button class="filter-option">生活梦想</button>
                    <button class="filter-option">礼物心愿</button>
                    <button class="filter-option">情感愿望</button>
                    <button class="filter-option">健康目标</button>
                </div>
            </div>
            
            <div class="filter-section">
                <div class="filter-title">发布时间</div>
                <div class="filter-options">
                    <button class="filter-option active">不限时间</button>
                    <button class="filter-option">今天</button>
                    <button class="filter-option">本周</button>
                    <button class="filter-option">本月</button>
                    <button class="filter-option">自定义</button>
                </div>
                
                <div class="date-range" style="margin-top: 10px; display: none;">
                    <input type="date" class="date-input" placeholder="开始日期">
                    <input type="date" class="date-input" placeholder="结束日期">
                </div>
            </div>
            
            <div class="filter-section">
                <div class="filter-title">互动量</div>
                <div class="filter-options">
                    <button class="filter-option active">不限</button>
                    <button class="filter-option">点赞>10</button>
                    <button class="filter-option">点赞>50</button>
                    <button class="filter-option">评论>5</button>
                    <button class="filter-option">评论>20</button>
                </div>
            </div>
            
            <div class="filter-actions">
                <button class="reset-btn" id="resetFilter">重置</button>
                <button class="apply-btn" id="applyFilter">应用筛选</button>
            </div>
        </div>
    </div>
    
    <!-- 分类标签 -->
    <div class="category-tabs">
        <button class="category-tab active">全部心愿</button>
        <button class="category-tab">旅行愿望</button>
        <button class="category-tab">学习目标</button>
        <button class="category-tab">生活梦想</button>
        <button class="category-tab">礼物心愿</button>
        <button class="category-tab">已实现</button>
    </div>
    
    <!-- 筛选结果统计 -->
    <div class="filter-result">
        <div>找到 <span class="result-count">24</span> 个心愿</div>
        <button class="clear-filters" id="clearFilters">清除筛选</button>
    </div>
    
    <!-- 许愿列表 -->
    <div class="wish-list" id="wishList">
        <!-- 多图许愿卡片 -->
        <div class="wish-card">
            <div class="wish-header">
                <img src="https://picsum.photos/id/64/100/100" alt="用户头像" class="wish-avatar">
                <div class="wish-user">
                    <div class="user-name">旅行爱好者</div>
                    <div class="wish-time">2小时前</div>
                </div>
            </div>
            
            <div class="wish-content">
                <h3 class="wish-title">今年夏天想去冰岛看极光</h3>
                <p class="wish-description">
                    一直梦想着能亲眼看到北极光，计划今年夏天和朋友一起去冰岛旅行，希望能实现这个愿望！正在努力攒钱中，有没有去过的朋友可以给些建议？
                </p>
                
                <div class="wish-media multi-media">
                    <div class="media-item">
                        <img src="https://picsum.photos/id/10/300/300" alt="冰岛风景1">
                    </div>
                    <div class="media-item">
                        <img src="https://picsum.photos/id/15/300/300" alt="冰岛风景2">
                    </div>
                    <div class="media-item">
                        <img src="https://picsum.photos/id/28/300/300" alt="冰岛风景3">
                    </div>
                </div>
                
                <div class="wish-meta">
                    <span class="wish-tag">旅行</span>
                    <span class="wish-tag">冰岛</span>
                    <span class="wish-status status-pending">待实现</span>
                </div>
            </div>
            
            <div class="wish-actions">
                <button class="action-btn like-btn">
                    <i class="far fa-heart"></i>
                    <span class="action-count">42</span>
                </button>
                <button class="action-btn comment-btn">
                    <i class="far fa-comment"></i>
                    <span class="action-count">18</span>
                </button>
                <button class="action-btn share-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
                <button class="action-btn save-btn">
                    <i class="far fa-bookmark"></i>
                    <span>收藏</span>
                </button>
            </div>
        </div>
        
        <!-- 单图许愿卡片 -->
        <div class="wish-card">
            <div class="wish-header">
                <img src="https://picsum.photos/id/26/100/100" alt="用户头像" class="wish-avatar">
                <div class="wish-user">
                    <div class="user-name">烘焙达人</div>
                    <div class="wish-time">昨天 15:30</div>
                </div>
            </div>
            
            <div class="wish-content">
                <h3 class="wish-title">希望能拥有一套专业烘焙工具</h3>
                <p class="wish-description">
                    最近迷上了烘焙，想升级一下装备，特别是那套德国产的烘焙模具，做出来的点心特别精致。希望下个月生日能收到这份礼物！
                </p>
                
                <div class="wish-media single-media">
                    <img src="https://picsum.photos/id/292/800/400" alt="烘焙工具">
                </div>
                
                <div class="wish-meta">
                    <span class="wish-tag">礼物</span>
                    <span class="wish-tag">烘焙</span>
                    <span class="wish-status status-pending">待实现</span>
                </div>
            </div>
            
            <div class="wish-actions">
                <button class="action-btn like-btn">
                    <i class="far fa-heart"></i>
                    <span class="action-count">27</span>
                </button>
                <button class="action-btn comment-btn">
                    <i class="far fa-comment"></i>
                    <span class="action-count">9</span>
                </button>
                <button class="action-btn share-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
                <button class="action-btn save-btn">
                    <i class="far fa-bookmark"></i>
                    <span>收藏</span>
                </button>
            </div>
        </div>
        
        <!-- 无图许愿卡片 -->
        <div class="wish-card">
            <div class="wish-header">
                <img src="https://picsum.photos/id/91/100/100" alt="用户头像" class="wish-avatar">
                <div class="wish-user">
                    <div class="user-name">读书爱好者</div>
                    <div class="wish-time">3天前</div>
                </div>
            </div>
            
            <div class="wish-content">
                <h3 class="wish-title">今年要读完50本书并写读书笔记</h3>
                <p class="wish-description">
                    立下一个flag，今年要完成50本书的阅读计划，每本都要写读书笔记。目前已经完成了12本，正在读《人类简史》，有一起打卡的朋友吗？
                </p>
                
                <div class="wish-media no-media"></div>
                
                <div class="wish-meta">
                    <span class="wish-tag">学习</span>
                    <span class="wish-tag">阅读</span>
                    <span class="wish-status status-pending">进行中</span>
                </div>
            </div>
            
            <div class="wish-actions">
                <button class="action-btn like-btn">
                    <i class="far fa-heart"></i>
                    <span class="action-count">63</span>
                </button>
                <button class="action-btn comment-btn">
                    <i class="far fa-comment"></i>
                    <span class="action-count">24</span>
                </button>
                <button class="action-btn share-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
                <button class="action-btn save-btn">
                    <i class="far fa-bookmark"></i>
                    <span>收藏</span>
                </button>
            </div>
        </div>
        
        <!-- 已实现的许愿卡片 -->
        <div class="wish-card">
            <div class="wish-header">
                <img src="https://picsum.photos/id/65/100/100" alt="用户头像" class="wish-avatar">
                <div class="wish-user">
                    <div class="user-name">健身达人</div>
                    <div class="wish-time">1周前</div>
                </div>
            </div>
            
            <div class="wish-content">
                <h3 class="wish-title">成功减掉10公斤，达成健身目标！</h3>
                <p class="wish-description">
                    经过6个月的努力，终于减掉了10公斤，体脂率从28%降到了20%！感谢这段时间朋友们的鼓励，特别是健身教练的专业指导。这个愿望终于实现了！
                </p>
                
                <div class="wish-media multi-media">
                    <div class="media-item">
                        <img src="https://picsum.photos/id/176/300/300" alt="健身成果1">
                    </div>
                    <div class="media-item">
                        <img src="https://picsum.photos/id/177/300/300" alt="健身成果2">
                    </div>
                </div>
                
                <div class="wish-meta">
                    <span class="wish-tag">健康</span>
                    <span class="wish-tag">健身</span>
                    <span class="wish-status status-fulfilled">已实现</span>
                </div>
            </div>
            
            <div class="wish-actions">
                <button class="action-btn like-btn active">
                    <i class="fas fa-heart"></i>
                    <span class="action-count">128</span>
                </button>
                <button class="action-btn comment-btn">
                    <i class="far fa-comment"></i>
                    <span class="action-count">45</span>
                </button>
                <button class="action-btn share-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
                <button class="action-btn save-btn">
                    <i class="far fa-bookmark"></i>
                    <span>收藏</span>
                </button>
            </div>
        </div>
        
        <!-- 加载更多 -->
        <button class="load-more" id="loadMore">
            <i class="fas fa-spinner fa-spin"></i>
            <span>加载更多心愿</span>
        </button>
    </div>
    
    <!-- 添加心愿按钮 -->
    <button class="add-wish-btn" id="addWishBtn">
        <i class="fas fa-plus"></i>
    </button>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <a href="#" class="nav-item">
            <i class="fas fa-home"></i>
            <span>首页</span>
        </a>
        <a href="#" class="nav-item active">
            <i class="fas fa-star"></i>
            <span>许愿墙</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-compass"></i>
            <span>发现</span>
        </a>
        <a href="#" class="nav-item">
            <i class="far fa-user"></i>
            <span>我的</span>
        </a>
    </div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // 提示消息
        function showToast(message) {
            // 检查是否已有toast
            let toast = document.querySelector('.toast-notification');
            if (toast) {
                toast.remove();
            }
            
            // 创建新toast
            toast = document.createElement('div');
            toast.className = 'toast-notification';
            toast.textContent = message;
            
            document.body.appendChild(toast);
            
            // 显示toast
            setTimeout(() => {
                toast.classList.add('show');
            }, 10);
            
            // 3秒后隐藏并移除
            setTimeout(() => {
                toast.classList.remove('show');
                setTimeout(() => toast.remove(), 300);
            }, 3000);
        }
        
        // 高级筛选面板切换
        const advancedFilterBtn = document.getElementById('advancedFilterBtn');
        const advancedFilterPanel = document.getElementById('advancedFilterPanel');
        
        advancedFilterBtn.addEventListener('click', () => {
            advancedFilterPanel.classList.toggle('show');
            if (advancedFilterPanel.classList.contains('show')) {
                showToast('显示高级筛选');
            } else {
                showToast('隐藏高级筛选');
            }
        });
        
        // 筛选选项切换
        document.querySelectorAll('.filter-option').forEach(option => {
            option.addEventListener('click', function() {
                // 如果是同一组内的选项，先移除同组其他选项的active类
                const parent = this.parentElement;
                parent.querySelectorAll('.filter-option').forEach(opt => {
                    opt.classList.remove('active');
                });
                // 给当前选项添加active类
                this.classList.add('active');
                
                // 处理自定义日期显示
                if (this.textContent === '自定义') {
                    document.querySelector('.date-range').style.display = 'flex';
                } else if (parent.querySelector('.filter-title').textContent === '发布时间') {
                    document.querySelector('.date-range').style.display = 'none';
                }
            });
        });
        
        // 快速筛选按钮
        document.querySelectorAll('.filter-btn:not(#advancedFilterBtn)').forEach(btn => {
            btn.addEventListener('click', function() {
                this.classList.toggle('active');
                if (this.classList.contains('active')) {
                    showToast(`已筛选: ${this.textContent.trim()}`);
                    updateFilterCount();
                } else {
                    showToast(`已取消筛选: ${this.textContent.trim()}`);
                    updateFilterCount();
                }
            });
        });
        
        // 分类标签切换
        const categoryTabs = document.querySelectorAll('.category-tab');
        categoryTabs.forEach(tab => {
            tab.addEventListener('click', () => {
                // 移除所有标签的active类
                categoryTabs.forEach(t => t.classList.remove('active'));
                // 给当前点击的标签添加active类
                tab.classList.add('active');
                
                // 显示加载状态
                const wishList = document.getElementById('wishList');
                const originalContent = wishList.innerHTML;
                wishList.innerHTML = `
                    <div class="d-flex justify-content-center p-5">
                        <div class="spinner-border text-primary" role="status">
                            <span class="visually-hidden">Loading...</span>
                        </div>
                    </div>
                `;
                
                // 模拟加载延迟
                setTimeout(() => {
                    wishList.innerHTML = originalContent;
                    showToast(`已切换到${tab.textContent}`);
                    updateFilterCount();
                    // 重新绑定事件
                    bindWishEvents();
                }, 800);
            });
        });
        
        // 应用筛选
        document.getElementById('applyFilter').addEventListener('click', () => {
            // 收集所有选中的筛选条件
            const selectedFilters = [];
            document.querySelectorAll('.filter-option.active').forEach(option => {
                if (option.textContent !== '全部状态' && option.textContent !== '全部分类' && 
                    option.textContent !== '不限时间' && option.textContent !== '不限') {
                    selectedFilters.push(option.textContent);
                }
            });
            
            if (selectedFilters.length > 0) {
                showToast(`已应用 ${selectedFilters.length} 个筛选条件`);
            } else {
                showToast('未选择筛选条件');
            }
            
            // 隐藏高级筛选面板
            advancedFilterPanel.classList.remove('show');
            // 更新结果计数
            updateFilterCount();
            
            // 显示加载状态
            const wishList = document.getElementById('wishList');
            const originalContent = wishList.innerHTML;
            wishList.innerHTML = `
                <div class="d-flex justify-content-center p-5">
                    <div class="spinner-border text-primary" role="status">
                        <span class="visually-hidden">Loading...</span>
                    </div>
                </div>
            `;
            
            // 模拟加载延迟
            setTimeout(() => {
                wishList.innerHTML = originalContent;
                bindWishEvents();
            }, 800);
        });
        
        // 重置筛选
        document.getElementById('resetFilter').addEventListener('click', () => {
            // 重置所有筛选选项
            document.querySelectorAll('.filter-option').forEach(option => {
                option.classList.remove('active');
                if (option.textContent === '全部状态' || option.textContent === '全部分类' || 
                    option.textContent === '不限时间' || option.textContent === '不限') {
                    option.classList.add('active');
                }
            });
            
            // 隐藏日期选择
            document.querySelector('.date-range').style.display = 'none';
            
            showToast('已重置筛选条件');
        });
        
        // 清除所有筛选
        document.getElementById('clearFilters').addEventListener('click', () => {
            // 重置快速筛选按钮
            document.querySelectorAll('.filter-btn').forEach(btn => {
                btn.classList.remove('active');
            });
            
            // 重置分类标签
            categoryTabs.forEach(t => t.classList.remove('active'));
            categoryTabs[0].classList.add('active');
            
            // 重置高级筛选选项
            document.querySelectorAll('.filter-option').forEach(option => {
                option.classList.remove('active');
                if (option.textContent === '全部状态' || option.textContent === '全部分类' || 
                    option.textContent === '不限时间' || option.textContent === '不限') {
                    option.classList.add('active');
                }
            });
            
            // 隐藏日期选择和高级筛选面板
            document.querySelector('.date-range').style.display = 'none';
            advancedFilterPanel.classList.remove('show');
            
            showToast('已清除所有筛选条件');
            updateFilterCount();
            
            // 显示加载状态
            const wishList = document.getElementById('wishList');
            const originalContent = wishList.innerHTML;
            wishList.innerHTML = `
                <div class="d-flex justify-content-center p-5">
                    <div class="spinner-border text-primary" role="status">
                        <span class="visually-hidden">Loading...</span>
                    </div>
                </div>
            `;
            
            // 模拟加载延迟
            setTimeout(() => {
                wishList.innerHTML = originalContent;
                bindWishEvents();
            }, 800);
        });
        
        // 排序按钮
        document.getElementById('sortBtn').addEventListener('click', () => {
            // 创建排序选项弹窗
            const sortOptions = document.createElement('div');
            sortOptions.className = 'position-fixed bottom-0 left-0 right-0 bg-white border-top border-light rounded-top-3 p-4 z-50';
            sortOptions.innerHTML = `
                <div class="text-center mb-4"><strong>排序方式</strong></div>
                <div class="list-group">
                    <button class="list-group-item list-group-item-action d-flex justify-content-between align-items-center">
                        最新发布
                        <i class="fas fa-check text-primary"></i>
                    </button>
                    <button class="list-group-item list-group-item-action">最多点赞</button>
                    <button class="list-group-item list-group-item-action">最多评论</button>
                    <button class="list-group-item list-group-item-action">最近更新</button>
                </div>
                <button class="btn btn-light w-100 mt-4" id="closeSort">取消</button>
            `;
            
            document.body.appendChild(sortOptions);
            
            // 点击排序选项
            sortOptions.querySelectorAll('.list-group-item').forEach(option => {
                if (!option.textContent.includes('取消')) {
                    option.addEventListener('click', () => {
                        showToast(`已按 ${option.textContent.trim()} 排序`);
                        document.body.removeChild(sortOptions);
                        
                        // 显示加载状态
                        const wishList = document.getElementById('wishList');
                        const originalContent = wishList.innerHTML;
                        wishList.innerHTML = `
                            <div class="d-flex justify-content-center p-5">
                                <div class="spinner-border text-primary" role="status">
                                    <span class="visually-hidden">Loading...</span>
                                </div>
                            </div>
                        `;
                        
                        // 模拟加载延迟
                        setTimeout(() => {
                            wishList.innerHTML = originalContent;
                            bindWishEvents();
                        }, 800);
                    });
                }
            });
            
            // 关闭排序弹窗
            document.getElementById('closeSort').addEventListener('click', () => {
                document.body.removeChild(sortOptions);
            });
        });
        
        // 更新筛选结果计数
        function updateFilterCount() {
            // 模拟筛选后的结果数量变化
            const activeFilters = document.querySelectorAll('.filter-btn.active').length + 
                                 (document.querySelector('.category-tab.active') ? 1 : 0) - 1; // 减去默认选中的全部
            
            let count = 24; // 初始数量
            if (activeFilters > 0) {
                // 随机减少一些数量，模拟筛选效果
                count = Math.max(5, count - Math.floor(Math.random() * 15) - activeFilters * 2);
            }
            
            document.querySelector('.result-count').textContent = count;
        }
        
        // 绑定许愿卡片事件
        function bindWishEvents() {
            // 点赞按钮
            document.querySelectorAll('.like-btn:not([data-bound])').forEach(btn => {
                btn.setAttribute('data-bound', 'true');
                btn.addEventListener('click', function() {
                    const icon = this.querySelector('i');
                    const countElem = this.querySelector('.action-count');
                    let count = parseInt(countElem.textContent);
                    
                    if (icon.classList.contains('far')) {
                        // 点赞
                        icon.classList.remove('far');
                        icon.classList.add('fas');
                        this.classList.add('active');
                        countElem.textContent = count + 1;
                        showToast('点赞成功');
                    } else {
                        // 取消点赞
                        icon.classList.remove('fas');
                        icon.classList.add('far');
                        this.classList.remove('active');
                        countElem.textContent = count - 1;
                        showToast('已取消点赞');
                    }
                });
            });
            
            // 评论按钮
            document.querySelectorAll('.comment-btn:not([data-bound])').forEach(btn => {
                btn.setAttribute('data-bound', 'true');
                btn.addEventListener('click', function() {
                    const wishTitle = this.closest('.wish-card').querySelector('.wish-title').textContent;
                    showToast(`查看 "${wishTitle}" 的评论`);
                });
            });
            
            // 分享按钮
            document.querySelectorAll('.share-btn:not([data-bound])').forEach(btn => {
                btn.setAttribute('data-bound', 'true');
                btn.addEventListener('click', function() {
                    showToast('分享成功');
                });
            });
            
            // 收藏按钮
            document.querySelectorAll('.save-btn:not([data-bound])').forEach(btn => {
                btn.setAttribute('data-bound', 'true');
                btn.addEventListener('click', function() {
                    const icon = this.querySelector('i');
                    
                    if (icon.classList.contains('far')) {
                        // 收藏
                        icon.classList.remove('far');
                        icon.classList.add('fas');
                        this.classList.add('active');
                        showToast('已收藏');
                    } else {
                        // 取消收藏
                        icon.classList.remove('fas');
                        icon.classList.add('far');
                        this.classList.remove('active');
                        showToast('已取消收藏');
                    }
                });
            });
            
            // 图片点击预览
            document.querySelectorAll('.media-item img, .single-media img').forEach(img => {
                img.addEventListener('click', function() {
                    showToast('图片预览功能');
                });
            });
        }
        
        // 加载更多
        document.getElementById('loadMore').addEventListener('click', function() {
            const btn = this;
            const originalText = btn.innerHTML;
            btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i><span>加载中...</span>';
            btn.disabled = true;
            
            // 模拟加载延迟
            setTimeout(() => {
                btn.innerHTML = originalText;
                btn.disabled = false;
                showToast('已加载更多心愿');
                
                // 复制第一个心愿卡片并修改内容
                const wishList = document.getElementById('wishList');
                const firstCard = wishList.querySelector('.wish-card:first-of-type');
                
                if (firstCard) {
                    const clone = firstCard.cloneNode(true);
                    // 修改一些内容以示区别
                    const randomId = Math.floor(Math.random() * 200) + 300;
                    clone.querySelector('.wish-avatar').src = `https://picsum.photos/id/${randomId}/100/100`;
                    
                    // 随机更改时间
                    const times = ['1小时前', '昨天', '3天前', '1周前'];
                    clone.querySelector('.wish-time').textContent = times[Math.floor(Math.random() * times.length)];
                    
                    // 插入到加载更多按钮前
                    wishList.insertBefore(clone, btn);
                    
                    // 重新绑定事件
                    bindWishEvents();
                }
            }, 1500);
        });
        
        // 添加心愿按钮
        document.getElementById('addWishBtn').addEventListener('click', () => {
            showToast('打开新建心愿页面');
        });
        
        // 返回按钮
        document.getElementById('backBtn').addEventListener('click', () => {
            showToast('返回上一页');
        });
        
        // 搜索功能
        document.querySelector('.search-input').addEventListener('keypress', function(e) {
            if (e.key === 'Enter' && this.value.trim() !== '') {
                showToast(`搜索: ${this.value.trim()}`);
                
                // 显示加载状态
                const wishList = document.getElementById('wishList');
                const originalContent = wishList.innerHTML;
                wishList.innerHTML = `
                    <div class="d-flex justify-content-center p-5">
                        <div class="spinner-border text-primary" role="status">
                            <span class="visually-hidden">Loading...</span>
                        </div>
                    </div>
                `;
                
                // 模拟加载延迟
                setTimeout(() => {
                    wishList.innerHTML = originalContent;
                    updateFilterCount();
                    bindWishEvents();
                }, 800);
            }
        });
        
        // 页面加载完成后初始化
        window.addEventListener('DOMContentLoaded', () => {
            bindWishEvents();
        });
    </script>
</body>
</html>

